import { createStore, applyMiddleware, combineReducers } from 'redux'
import counterReducer from './reducers/counter_reducer'
import personReducer from './reducers/person_reducer'
// 引入 redux-thunk,用于支持异步 action0
import thunk from 'redux-thunk'
// 引入 redux-devtools-extension 开启 redux chrome调试工具
import { composeWithDevTools } from 'redux-devtools-extension'

//汇总所有的 reducer 边长一个总的 reducer
const allReducer = combineReducers({
    counter: counterReducer,
    person: personReducer
})

// 创建 Store 对象，reducer 为入参
export default createStore(allReducer, composeWithDevTools(applyMiddleware(thunk)))